<?php
namespace Admin\Controller;
use Think\Controller;
class MyController extends Controller {
    public function _initialize(){
        $admin_info = array('id' => '1', 'adm_name' => 'admin');

        if (!$admin_info) {
            echo "<script language=\"javascript\">";
            echo "alert('请登录后操作');";
            echo "top.location.href='/Admin/Index/login';</script>";
            exit;
        }
        $this->assign('admin_info', $admin_info);
    }

}